var frameApp = new Vue({
    el: '#vueApp',
    data: {
        sid: '88e2fcc3-4450-4594-8758-67bc7c7df9ec',
        companyNotice: [],
        tableData: [
            {
                title: "公告标题1",
                author: "张三",
                signer: "李四",
                department: "人力资源部",
                publishDate: "2024-07-01",
            },
            {
                title: "公告标题2",
                author: "王五",
                signer: "赵六",
                department: "财务部",
                publishDate: "2024-07-02",
            },
            {
                title: "公告标题3",
                author: "钱七",
                signer: "孙八",
                department: "市场部",
                publishDate: "2024-07-03",
            },
            {
                title: "公告标题4",
                author: "周九",
                signer: "吴十",
                department: "技术部",
                publishDate: "2024-07-04",
            },
        ],
        tableColumns: [
            {prop: "title", label: "标题", sortType: "asc", filterKeyword: ""},
            {prop: "author", label: "发布人", sortType: "", filterKeyword: ""},
            {prop: "signer", label: "签发人", sortType: "", filterKeyword: ""},
            {prop: "dept", label: "部门", sortType: "", filterKeyword: ""},
            {
                prop: "publishDate",
                label: "发布时间",
                sortType: "",
                filterKeyword: "",
            },
        ],
        pagination: {
            currentPage: 1,
            pageSize: 10,
        },
    },
    created() {
        // 初始化时格式化当前日期
        var sid = this.sid;
        this.getNoticeList();
    },
    methods: {
        getNoticeListData: function getNoticeList(sid, params) {
            return request({
                method: 'get',
                url: '/portal/r/jd?sid=' + this.sid + '&cmd=portal.grounp.notice&query=${JSON.stringify(params)}'
            });
        },
        getNoticeList: function () {
            const _this = this;
            const params = {
                "nowPage": 1,
                "pageNum": 10,
                "fieldQuery": {
                    "title": "",
                    "publisher": "",
                    "signer": "李四",
                    "dept": "",
                    "releaseTime": {
                        "beginTime": "2023-01-04",
                        "endTime": "2024-02-05"
                    }
                },
                "order": {
                    "title": "asc",
                    "publisher": "desc",
                    "signer": "asc",
                    "dept": "desc",
                    "releaseTime": "asc"
                }
            };
            _this.getNoticeListData(_this.sid, params)
                .then(response => {
                    console.log(response, 'jiekou!!!!') // 假设响应数据是一个通知列表
                    _this.companyNotice = response.data.list;
                })
                .catch(error => {
                    console.error('获取通知列表失败', error);
                    // 处理错误响应，例如没有用户会话的情况
                    if (error.response && error.response.data && error.response.data.errorCode === '400') {
                        console.error(error.response.data.msg);
                    }
                });
        },
        updateFilterKeyword: function (column, event, index) {

            //    this.tableColumns[index].filterKeyword='4444444444444'


        },

        applyChanges: function () {
            // 应用整体排序和筛选
            console.log("应用整体排序和筛选");
        },
        applyColumnChanges: function (column) {
            // 这里可以处理点击确定按钮后的逻辑，例如根据 column.sortType 和 column.filterKeyword 更新 tableData
            console.log('Sort type:', column.sortType);
            console.log('Filter keyword:', column.filterKeyword);
            // 在实际应用中，根据 column.sortType 和 column.filterKeyword 更新 tableData
        },
        handleSizeChange: function (size) {
            // 分页大小变更
            console.log("分页大小变更", size);
        },
        handleCurrentChange: function (page) {
            // 当前页变更
            console.log("当前页变更", page);
        },
    },
});